import React, { Component } from 'react';
import {View,Image, Block} from '@tarojs/components';
import './popView.scss';

interface CustomerProps {
  popInfo: any
  offsetTop: any
  isSeller: any
  commissionPrice: any
}

export default class PopView extends Component<CustomerProps> {
  constructor(props: CustomerProps) {
    super(props);
  }

  render() {
    const { popInfo, offsetTop = 220, isSeller = false, commissionPrice = 1 }  = this.props;
    return (
      <Block>
        { popInfo && <View className='pop-view-wrap' style={`top: ${offsetTop}`}>
          <View className='pop-view-wrap-item'>
            <View className='pop-view-items-img'><Image mode='aspectFill' src={popInfo.user_photo} className='pop-view-items-images' /></View>
            <View className='pop-view-items-content'>{popInfo.user_name} {(isSeller && !!commissionPrice) ? `购买了该商品赚了${commissionPrice}元` : '1分钟前购买了该商品'}</View>
          </View>
        </View> }
      </Block>
    )
  }
}
